package itheima.com.Reader;

import java.io.*;

public class BufferedCopy_ {

    public static void main(String[] args) {


//        复制文件
        String filePath = "D:\\一条小团团\\demo.txt";
        String filePath2 = "D:\\一条小团团\\demo1.txt";

        BufferedReader bufferedReader = null;
        BufferedWriter bufferedWriter = null;
        String bufLen;
//        if(filePath2.){}
        try {
            bufferedReader  = new BufferedReader(new FileReader(filePath));
            bufferedWriter = new BufferedWriter(new FileWriter(filePath2,true));

            while ((bufLen = bufferedReader.readLine()) != null) {
                bufferedWriter.write(bufLen);
                bufferedWriter.newLine();
                bufferedWriter.newLine();
            }


        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                bufferedReader.close();
                bufferedWriter.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }


    }

}
